package WaiBao;

import java.util.Arrays;

public class YuSuPu {
    public static void main(String[] args) {
        String[] name = {"古巨基(班长)", "李华华(团支书)", "小李(学习委员)", "谢娜(体育委员)", "王梦娜", "王多多", "王所欲", "王多鱼", "李金城", "旺进程", "往往", "阿超",
                "阿伟", "王凯", "雷强", "雷霆", "雷神", "项羽", "赵子武", "巴郎", "江小鱼", "鲁岩", "张冲", "乌云", "立夏", "张紫薇", "李浩男", "王婷婷",
                "张小伟", "玉苏普·亚森(学生)"};//考生本人: 玉苏普·亚森(学生)
        int[] age = {21, 20, 18, 19, 19, 22,19, 21, 20, 20, 19, 18, 23, 21, 20, 19, 18, 20, 18, 18, 19, 19, 20, 20, 20, 19,20,19,20, 22};//最后一位：考生年龄:22

        double[] yixun1 = {77, 86, 80, 84, 89, 69, 70, 80, 84, 80, 81, 80, 85, 84, 75, 68, 70, 70, 76, 84, 92, 91, 95, 65, 75, 74, 94, 84, 84, 96};
        double[] yixun2 = {74, 84, 90, 76, 75, 77, 79, 79, 91, 70, 70, 77, 86, 95, 80, 64, 76, 79, 64, 98, 72, 71, 95, 86, 75, 84, 84, 75, 81, 95};
        double[] yixun3 = {90, 76, 84, 85, 74, 66, 68, 74, 80, 80, 93, 87, 85, 65, 85, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 87, 73, 75, 89, 96};

        double tuandui1;//代表每个学生的总分
        double tuandui2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            tuandui1 = yixun1[i] + yixun2[i] +yixun3[i];
//            tuandui2 = (tuandui1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + tuandui1);
//            System.out.println(name[i] + "的平均分为:" + tuandui2);
//        }


        double junjie1 = 0,junjie2 = 0;
        double[] Arr = new double[30];
//        for (int i = 0; i < 30; i++) {
//            junjie1 =yixun1[i] + yixun2[i] + yixun3[i];
//            junjie2= (junjie1 * 1.0) / 3;
//            Arr[i] = junjie2;
//        }
//
//        for (int i = 0; i < Arr.length - 1; i++) {
//            for (int j = 0; j < Arr.length - i - 1; j++) {
//                if (Arr[j] < Arr[j + 1]) {
//                    double tep = Arr[j];
//                    Arr[j] = Arr[j + 1];
//                    Arr[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(Arr[i]);
//        }



        double xiulian1 = 0,xiulian2 = 0, xiulian3 = 0;//计算每门课的平均分
        double demo1 = 0, demo2 = 0, demo3 = 0;//计算每门课标准差
        double women1 = 0,women2 = 0, women3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i <yixun1.length; i++) {
            he += yixun1[i];
        }
        xiulian1 = (he * 1.0) / 30;
        System.out.println("生物化学的班级平均分为:" + xiulian1);
        double Sum = 0;
        for (int i = 0; i < yixun2.length; i++) {
            Sum += yixun3[i];
        }
        xiulian2 = (Sum * 1.0) / 30;
        System.out.println("物理化学的班级平均分为:" +xiulian2);
        double sum = 0;
        for (int i = 0; i < yixun3.length; i++) {
            sum += yixun3[i];
        }
        xiulian3 = (sum * 1.0) / 30;
        System.out.println("电子与电工技术的班级平均分为:" + xiulian3);


        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i < yixun1.length; i++) {
            c1 += (yixun1[i] -xiulian1) * (yixun1[i] -xiulian1);
        }
        demo1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:" + demo1);
        for (int i = 0; i < yixun2.length; i++) {
            c2 += (yixun2[i] - xiulian2) * (yixun2[i] - xiulian2);
        }
        demo2 = Math.sqrt(c2*1.0/30);
        System.out.println("物理化学的班级标准差为:" + demo2);

        for (int i = 0; i <yixun3.length; i++) {
            c3 += (yixun3[i] - xiulian3) * (yixun3[i] - xiulian3);
        }
        demo3 = Math.sqrt(c3*1.0/30);
        System.out.println("电子与电工技术的班级标准差为:" + demo3);
////////
//////
//////
        Arrays.sort(yixun1);
        Arrays.sort(yixun2);
        Arrays.sort(yixun3);
        women1 = (yixun1[14] + yixun2[15]) * 1.0 / 2;
        women2 = (yixun2[14] + yixun2[15]) * 1.0 / 2;
        women3 = (yixun3[14] + yixun3[15]) * 1.0 / 2;
        System.out.println("生物化学的中位数为:" + women1);
        System.out.println("物理化学的中位数为:" + women2);
        System.out.println("电子与电工技术的中位数为:" + women3);


    }
}
